<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveScaffold::Actions::LiveSearch</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveScaffold::Actions::LiveSearch</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/active_scaffold/lib/actions/live_search_rb.html">
                vendor/plugins/active_scaffold/lib/actions/live_search.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000283">do_search</a>&nbsp;&nbsp;
      <a href="#M000281">included</a>&nbsp;&nbsp;
      <a href="#M000284">live_search_authorized?</a>&nbsp;&nbsp;
      <a href="#M000282">show_search</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000281" class="method-detail">
        <a name="M000281"></a>

        <div class="method-heading">
          <a href="#M000281" class="method-signature">
          <span class="method-name">included</span><span class="method-args">(base)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000281-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000281-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/live_search.rb, line 3</span>
3:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
4:       <span class="ruby-identifier">base</span>.<span class="ruby-identifier">before_filter</span> <span class="ruby-identifier">:live_search_authorized?</span>, <span class="ruby-identifier">:only</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:show_search</span>
5:       <span class="ruby-identifier">base</span>.<span class="ruby-identifier">before_filter</span> <span class="ruby-identifier">:do_search</span>
6:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000282" class="method-detail">
        <a name="M000282"></a>

        <div class="method-heading">
          <a href="#M000282" class="method-signature">
          <span class="method-name">show_search</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000282-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000282-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/live_search.rb, line 8</span>
 8:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_search</span>
 9:       <span class="ruby-identifier">respond_to</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span><span class="ruby-operator">|</span>
10:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">html</span> <span class="ruby-keyword kw">do</span>
11:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">successful?</span>
12:             <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;live_search&quot;</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)
13:           <span class="ruby-keyword kw">else</span>
14:             <span class="ruby-identifier">return_to_main</span>
15:           <span class="ruby-keyword kw">end</span>
16:         <span class="ruby-keyword kw">end</span>
17:         <span class="ruby-identifier">type</span>.<span class="ruby-identifier">js</span> { <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;live_search&quot;</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>) }
18:       <span class="ruby-keyword kw">end</span>
19:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000283" class="method-detail">
        <a name="M000283"></a>

        <div class="method-heading">
          <a href="#M000283" class="method-signature">
          <span class="method-name">do_search</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000283-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000283-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/live_search.rb, line 23</span>
23:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_search</span>
24:       <span class="ruby-ivar">@query</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:search</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-value str">''</span>
25: 
26:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@query</span>.<span class="ruby-identifier">empty?</span>
27:         <span class="ruby-identifier">columns</span> = <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">live_search</span>.<span class="ruby-identifier">columns</span>
28:         <span class="ruby-identifier">like_pattern</span> = <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">live_search</span>.<span class="ruby-identifier">full_text_search?</span> <span class="ruby-value">? </span><span class="ruby-value str">'%?%'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'?%'</span>
29:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">active_scaffold_conditions</span> = <span class="ruby-identifier">merge_conditions</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">active_scaffold_conditions</span>, <span class="ruby-constant">ActiveScaffold</span><span class="ruby-operator">::</span><span class="ruby-constant">Finder</span>.<span class="ruby-identifier">create_conditions_for_columns</span>(<span class="ruby-ivar">@query</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>), <span class="ruby-identifier">columns</span>, <span class="ruby-identifier">like_pattern</span>))
30: 
31:         <span class="ruby-identifier">includes_for_search_columns</span> = <span class="ruby-identifier">columns</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">includes</span>}.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">compact</span>
32:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">active_scaffold_joins</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">includes_for_search_columns</span>
33: 
34:         <span class="ruby-identifier">active_scaffold_config</span>.<span class="ruby-identifier">list</span>.<span class="ruby-identifier">user</span>.<span class="ruby-identifier">page</span> = <span class="ruby-keyword kw">nil</span>
35:       <span class="ruby-keyword kw">end</span>
36:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000284" class="method-detail">
        <a name="M000284"></a>

        <div class="method-heading">
          <a href="#M000284" class="method-signature">
          <span class="method-name">live_search_authorized?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
The default security delegates to <a
href="../../ActiveRecordPermissions.html">ActiveRecordPermissions</a>. You
may override the method to customize.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000284-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000284-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/actions/live_search.rb, line 40</span>
40:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">live_search_authorized?</span>
41:       <span class="ruby-identifier">authorized_for?</span>(<span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:read</span>)
42:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>